<?php
 include_once('connection/connection.php');
	$data=$_GET['data'];
    $val=$_GET['val'];
		function getName($colName,$id)
          {
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
          }
 if($data=='district')
	 {
          echo "<select name='district' id='district' class='txt' onChange=\"changeForm('form_id',this.value)\">\n";
          echo "<option value='0'>==== District ====</option>\n";
          $result=mysql_query("select DISTINCT district_id from tbl_dtls_q1_main where type_scheme !='RWSS' and form_id !=''");
          while(list($id)=mysql_fetch_array($result))
		  {
               echo "<option value=\"$id\">".getName('district',$id)."</option> \n" ;
          }
		  echo "</select>";    
	 }
	 
	
	 if($data=='form_id')
	 {		
         	echo "<select name='form_id' class='txt'>\n
         	<option value='0'>=====Form Id====</option>\n";
         	$val2=$val;
         	$val = substr($val,0,10);                            
         	$result=mysql_query("SELECT DISTINCT form_id from tbl_dtls_q1_main where district_id='$val' and type_scheme!='RWSS' order by form_id desc");
         	while(list($id)=mysql_fetch_array($result))
		 	{       
             	 echo "<option value=\"$id\">$id</option> \n";
         	}	
			echo "</select>"; 	
		}
		
?>
